var ordersService = {
    source: {},
    useraddressList: function (type, productGroupRootId, fn) {
        Api.get("orders.useraddressList", {'urlParams': {'type': type, 'transportType': productGroupRootId}}, fn);
    },
    searchCountry: function (param, fn) {
        if (!param) param = {};
        Api.get("orders.country", {'urlParams': param}, fn);
    },
    searchCity: function (param, fn) {
        Api.get("orders.searchArea", {'urlParams': param}, fn);
    },
    deleteAddr: function (param, fn) {
        Api.post("orders.deleteAddr", {'urlParams': param}, fn);
    },
    editAddr: function (param, fn) {
        Api.post("orders.editAddr", {'urlParams': param}, fn);
    },
    defaultAddr: function (id, type, transportType, fn) {
        Api.post("orders.defaultAddr", {'seatParams': {newId: id, type: type, transportType: transportType}}, fn);
    },
    productOne: function (id, fn) {
        Api.get("orders.productOne", {'seatParams': {id: id}}, fn);
    },
    productList: function (q, currentPage, fn) {
        if (!currentPage) {
            currentPage = 1;
        }
        Api.get("orders.productList", {"urlParams": {q: q, pageIndex: currentPage, pageSize: 10}}, fn);
    },
    serviceoptional: function (id, fn) {
        Api.get("orders.serviceoptional", {'seatParams': {id: id}}, fn);
    },
    prodcutCargo: function (id, fn) {
        Api.get("orders.prodcutCargo", {'seatParams': {id: id}}, fn);
    },
    //获取计量单位
    unitbase: function (fn) {
        Api.get("orders.unitbase", fn);
    },
    getUnitbase: function (config, fn) {
        Api.get("orders.unitbase", config, fn);
    },
    oneOrderByBillno: function (billno, fn) { //根据orderNo查询订单详情
        Api.get("orders.oneOrderByBillNo", {"seatParams": {orderNo: billno}}, fn);
    },
    cusOrderNo: function (param, fn) {  //客户获取运单号
        Api.get("orders.cusOrderNo", {'urlParams': param}, fn);
    },
    cusOrderNoExist: function (num, id, fn) {  //检查客户的运单号是否存在
        Api.post("orders.cusOrderNo2", {'seatParams': {externalNo: num, id: id}}, fn);
    },
    newOrder: function (data, fn) {  //新增订单
        Api.post("orders.newOrder", {'urlParams': data}, fn);
    },
    modifyOrder: function (id, data, fn) { //修改订单
        Api.post("orders.oneOrderByBillNo", {'urlParams': data, 'seatParams': {orderNo: id}}, fn);
    },
    orderstatus: function (fn) { //获取订单的所有状态数据
        Api.get("orders.orderstatus", fn);
    },
    unitWeight: function (fn) {
        Api.get("orders.unitWeight", fn);
    },
    saleProduct: function (param, fn) {
        Api.post("orders.saleProduct", {'urlParams': param}, fn);
    },
    checkcustomeraddr: function (uid, customerId, transportType, fn) {
        Api.get("orders.checkcustomeraddr", {
            'seatParams': {
                uid: uid,
                customerId: customerId,
                transportType: transportType
            }
        }, fn);
    },
    checkweight: function (uid, weight, unit, fn) {
        Api.post("orders.checkweight", {
            'urlParams': {weight: weight, weightUnitCode: unit},
            'seatParams': {uid: uid}
        }, fn);
    },
    getAddressType: function (config, callback) {
        Api.get("orders.getAddressType", config, callback);
    },
    getAirSeaData: function (config, callback) {
        Api.get("orders.getAirSeaData", config, callback);
    },
    hasReceived: function (config, callback) {
        Api.get("orders.hasReceived", config, callback);
    },
    getProGroupRootId: function (config, callback) {
        Api.get("orders.getProGroupRootId", config, callback);
    },
    getOrderByOid: function (config, callback) {
        Api.get("orders.oneOrderByBillNo", config, callback);
    },
    getOrderLogistics: function (config, callback) {
        Api.post("orders.getOrderLogistics", config, callback);
    },
    getProductById: function (config, callback) {
        Api.get("orders.productOne", config, callback);
    },
    getAddress: function (config, callback) {
        Api.get("orders.getAddress", config, callback);
    },
    getProductCountry: function (config, callback) {
        Api.get("orders.getProductCountry", config, callback);
    },
    getProductCity: function (config, callback) {
        Api.get("orders.getProductCity", config, callback);
    },
    getProductSeaAir: function (config, callback) {
        Api.get("orders.getProductSeaAir", config, callback);
    },
    editOrder: function(config, callback){
        Api.post("orders.oneOrderByBillNo", config, callback);
    },
    addOrder: function(config, callback){
        Api.post("orders.newOrder", config, callback);
    },
    getOrderByHighVolumeOrderId:function (config, callback) {
        Api.get("orders.getOrderByHighVolumeOrderId", config, callback);
    },
    modifyHighVolumeOrder:function (config, callback) {
        Api.post("orders.modifyHighVolumeOrder", config, callback);
    }
};

module.exports = ordersService;
